﻿namespace DesignPatterns.SingletonPattrens
{
    /// <summary>
    /// 懒汉单例模式，使用时才会创建单例，但是不适用高并发多线程
    /// </summary>
    public class LazySingleton
    {
        private static LazySingleton instance;
        private LazySingleton() { }
        public static LazySingleton getInstance()
        {
            if (instance == null)
            {
                instance = new LazySingleton();
            }
            return instance;
        }
    }
}
